home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / tcl / testsuite / config / unix-tcl.exp
Text File  |  1993-04-27  |  3KB  |  124 lines

  1. #   Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
  2.  
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 2 of the License, or
  6. # (at your option) any later version.
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10. # GNU General Public License for more details.
  11. # You should have received a copy of the GNU General Public License
  12. # along with this program; if not, write to the Free Software
  13. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  14.  
  15. # Please email any bugs, comments, and/or additions to this file to:
  16. # bug-dejagnu@prep.ai.mit.edu
  17.  
  18. # This file was written by Rob Savoye. (rob@cygnus.com)
  19.  
  20. set testdrv "tclTest"
  21.  
  22. #
  23. # tcl_version -- extract and print the version number of tcl
  24. #
  25. proc tcl_version { } {
  26.     global testdrv
  27.     global subdir
  28.  
  29.     set version ""
  30.     catch {exec echo "info tclversion" | $testdrv} tmp
  31.     regexp "\[0-9\]\.\[0-9\.\]+" $tmp version
  32.     clone_output "Tcl library is version $version\n"
  33.     unset tmp
  34.     unset version
  35. }
  36.  
  37. #
  38. # tcl_load -- loads the program. For tcl, we just execute it
  39. #
  40. proc tcl_load { arg } {
  41.     global verbose
  42.     global exec_output
  43.     global subdir
  44.     global testdrv
  45.     global exec_output
  46.     global spawn_id
  47.  
  48.     if ![file exists $arg] then {
  49.     error "$arg does not exist."
  50.     return -1
  51.     }
  52.  
  53.     if $verbose>1 then {
  54.     send_user "Sourcing $arg...\n"
  55.     }
  56.     send "source $arg\n"
  57.     return 0
  58. }
  59.  
  60. #
  61. # tcl_exit -- exit the test driver for tcl
  62. #
  63. proc tcl_exit {} {
  64. }
  65.  
  66. #
  67. # tcl_start -- start the test driver for tcl
  68. #
  69. proc tcl_start { } {
  70.     global testdrv
  71.  
  72.     global objdir
  73.     global subdir
  74.     global srcdir
  75.     global verbose
  76.     global spawn_id
  77.     
  78.     set testdrv "$objdir/$testdrv"
  79.     set defs    "$srcdir/../tests/defs"
  80.  
  81.     spawn $testdrv
  82.     send "source $defs\n"
  83.     expect {
  84.     -re ".*source $defs.*$" {
  85.         verbose "Sourced $defs" 1
  86.         }
  87.     "Error: couldn't read file*" {
  88.         error "Couldn't source $defs"
  89.         return -1
  90.     }
  91.     "%" {
  92.         verbose "Sourced $defs" 1
  93.         return 0
  94.         }
  95.     timeout {
  96.         error "Timed out sourcing $defs."
  97.         return 1
  98.     }
  99.     }
  100.  
  101.     send "set VERBOSE 1\n"
  102.     expect {
  103.     -re "set VERBOSE 1.*1.*%" {
  104.         if $verbose>1 then {
  105.         send_user "Set verbose flag for tests\n"
  106.         }        
  107.     }
  108.     timeout {
  109.         error "Timed out setting verbose flag."
  110.     }
  111.     }
  112.     return $spawn_id
  113. }
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.